from django.db import models


# Create your models here.
class VersionControl(models.Model):
	class Meta:
		db_table = 'version_control'
		verbose_name_plural = "版本记录"
		# verbose_name_ = '版本控制'
		ordering = ["-version", "-upgrade_date"]
		managed = False

	id = models.BigIntegerField(primary_key=True)
	app_name = models.CharField(null=True, max_length=50)
	platform = models.CharField(null=True, max_length=20)
	version = models.CharField(null=True, max_length=255)
	sort_no = models.PositiveIntegerField(null=True)
	is_supported = models.PositiveSmallIntegerField(null=True)
	# update_url = models.CharField(null=True, max_length=255)
	update_url = models.URLField(null=True, max_length=255)
	upgrade_info = models.CharField(null=True, max_length=255)
	upgrade_date = models.DateTimeField(null=True)


	def __str__(self):
		return self.version


	def theNewVerstion(self, arg):
		return self.filter(platform="android").order_by("-upgrade_date").first()
